Skip to content

Instantly share code, notes, and snippets.

@wteuber
wteuber / encrypt_decrypt.rb
Last active May 10, 2024 12:04
Simply encrypt and decrypt Strings in Ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end
@cmtickle
cmtickle / patching_magento2_app_code.md
Last active May 10, 2024 12:04
Patching Magento 2 Code

To patch code in Composer modules

  1. composer require cweagans/composer-patches
  2. Create your patch file as normal (referencing the paths to file in /vendor) and put it in a '.patches' folder at the top level of your code base.
  3. Edit composer.json to apply the patch(es) as below (this goes at the first level of composer.json) :
    "extra": {
        "magento-force": "override",
        "enable-patching": true,
        "patches-file": "composer.patches.json"
 },
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@UtpalMaiti
UtpalMaiti / algo expert Systems Design Quiz With answers(Ans.).txt
Last active May 10, 2024 12:03
algo expert Systems Design Quiz With answers(Ans.).txt
The following is often used as an index for spatial data that needs to be queried
with low latency:
A SQL database.
A geofence.
Ans. quadtree.
A shard.
When designing an API endpoint to list some arbitrary entities, like comments on a
video or posts on a news feed, you typically want the endpoint to support:
Deletion.
@acapola
acapola / aes-ni.c
Created August 31, 2015 14:42
AES128 how-to using GCC and Intel AES-NI
#include <stdint.h> //for int8_t
#include <string.h> //for memcmp
#include <wmmintrin.h> //for intrinsics for AES-NI
//compile using gcc and following arguments: -g;-O0;-Wall;-msse2;-msse;-march=native;-maes
//internal stuff
//macros
#define DO_ENC_BLOCK(m,k) \
do{\
@archerslaw
archerslaw / virtio-nic multi-queue support - qemu-kvm
Created April 21, 2014 06:11
virtio-nic multi-queue support - qemu-kvm
1.Boot the guest with multiple queues(queues=4) nic.
e.g:...-device virtio-net-pci,netdev=dev1,mac=9a:e8:e9:ea:eb:ec,id=net1,vectors=9,mq=on
-netdev tap,id=dev1,vhost=on,script=/etc/qemu-ifup-switch,queues=4
2.Using ethtool -L enable mq in guest
[Guest] # ethtool -L eth0 combined 4
3.Using ethtool -l eth0 can see the channel parameters of the interface like:
Pre-set maximums:
# ethtool -l eth0
#!/usr/bin/env zsh
# It is possible to either define direnv_postload as a command, or append
# an arbitrary function into the direnv_postload_functions array.
typeset -ag direnv_postload_functions
_direnv_notify_postload() {
local functions=(direnv_postload "${direnv_postload_functions[@]}")
local f
for f in "${functions[@]}"; do
@PawelJagus
PawelJagus / md5algorithm.abap
Created July 19, 2012 17:22
MD5 algorithm in ABAP with Update function
*&---------------------------------------------------------------------*
*& Report ZZZ
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zzz.
@kangarko
kangarko / README.md
Last active May 10, 2024 11:51
15-Minute Minecraft Plugin Tutorial For 1.8.8 - 1.20

15-Minute Minecraft Plugin Tutorial For 1.8.8 - 1.20

In this new Minecraft plugin development guide, I'll show you how to make Minecraft plugins for Bukkit, Spigot and Paper.

This guide covers Minecraft plugins for 1.8.8 to 1.20.

We'll be using IntelliJ with a dedicated extension for Minecraft plugin development to make this process fast and easy.

If you're tired of limiting plugins and waiting for developers, if you want to make a truly unique servers customized from the ground up, click here and I'll show you how to do it in 20 days (without experience).